package com.google.android.material.snackbar;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.MeasureSpec;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import androidx.core.view.ViewCompat;
import o.aqu.c;
import o.aqu.j;
import o.aqu.n;
import o.ast;

@RestrictTo({d.LIBRARY_GROUP})
public class SnackbarContentLayout extends LinearLayout implements ast {
    private Button ˋ;
    private int ˎ;
    private int ˏ;
    private TextView ॱ;

    public SnackbarContentLayout(Context context) {
        this(context, null);
    }

    public SnackbarContentLayout(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, n.ˎꓸ);
        this.ˎ = obtainStyledAttributes.getDimensionPixelSize(n.ˎˍ, -1);
        this.ˏ = obtainStyledAttributes.getDimensionPixelSize(n.ˎˌ, -1);
        obtainStyledAttributes.recycle();
    }

    protected void onFinishInflate() {
        super.onFinishInflate();
        this.ॱ = (TextView) findViewById(j.ˏॱ);
        this.ˋ = (Button) findViewById(j.ʽ);
    }

    protected void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        if (this.ˎ > 0 && getMeasuredWidth() > this.ˎ) {
            i = MeasureSpec.makeMeasureSpec(this.ˎ, 1073741824);
            super.onMeasure(i, i2);
        }
        int dimensionPixelSize = getResources().getDimensionPixelSize(c.ˊॱ);
        int dimensionPixelSize2 = getResources().getDimensionPixelSize(c.ˏॱ);
        int i3 = this.ॱ.getLayout().getLineCount() > 1 ? 1 : 0;
        if (i3 == 0 || this.ˏ <= 0 || this.ˋ.getMeasuredWidth() <= this.ˏ) {
            if (i3 == 0) {
                dimensionPixelSize = dimensionPixelSize2;
            }
            if (ˊ(0, dimensionPixelSize, dimensionPixelSize)) {
                dimensionPixelSize = 1;
            }
            dimensionPixelSize = 0;
        } else {
            if (ˊ(1, dimensionPixelSize, dimensionPixelSize - dimensionPixelSize2)) {
                dimensionPixelSize = 1;
            }
            dimensionPixelSize = 0;
        }
        if (dimensionPixelSize != 0) {
            super.onMeasure(i, i2);
        }
    }

    private boolean ˊ(int i, int i2, int i3) {
        boolean z = false;
        if (i != getOrientation()) {
            setOrientation(i);
            z = true;
        }
        if (this.ॱ.getPaddingTop() == i2 && this.ॱ.getPaddingBottom() == i3) {
            return z;
        }
        ˊ(this.ॱ, i2, i3);
        return true;
    }

    private static void ˊ(View view, int i, int i2) {
        if (ViewCompat.ʼॱ(view)) {
            ViewCompat.ˏ(view, ViewCompat.ʻ(view), i, ViewCompat.ᐝ(view), i2);
        } else {
            view.setPadding(view.getPaddingLeft(), i, view.getPaddingRight(), i2);
        }
    }

    public void ˏ(int i, int i2) {
        this.ॱ.setAlpha(0.0f);
        this.ॱ.animate().alpha(1.0f).setDuration((long) i2).setStartDelay((long) i).start();
        if (this.ˋ.getVisibility() == 0) {
            this.ˋ.setAlpha(0.0f);
            this.ˋ.animate().alpha(1.0f).setDuration((long) i2).setStartDelay((long) i).start();
        }
    }

    public void ˎ(int i, int i2) {
        this.ॱ.setAlpha(1.0f);
        this.ॱ.animate().alpha(0.0f).setDuration((long) i2).setStartDelay((long) i).start();
        if (this.ˋ.getVisibility() == 0) {
            this.ˋ.setAlpha(1.0f);
            this.ˋ.animate().alpha(0.0f).setDuration((long) i2).setStartDelay((long) i).start();
        }
    }
}
